package global

import (
	"github.com/astaxie/beego"
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

/*
Date:2021/11/21
Time:1:31 上午
*/
var DBSession *gorm.DB

func _InitDB() {
	mysqlConf := beego.AppConfig.String("master_db")
	var err error
	DBSession, err = gorm.Open("mysql", mysqlConf)
	if err != nil {
		panic("初始化数据库失败" + err.Error())
	}
	DBSession.SingularTable(true)
}

func InitEnv() {
	_InitDB()
}
